import re
# s = "i love apple,banana,orange"
# res = re.findall('[applebananaorange]',s)
# print('res=',res)

# 同时匹配.com和.cn结尾的域名
s1='www.baidu.com www.sina.cn www.google.com'
res1 = re.findall('www\.(\w+)\.(?:com|cn)',s1)
print('res1=',res1)